package com.tianyi.sfzy1.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tianyi.sfzy1.domain.Psychologyknowledge;
import com.tianyi.sfzy1.mapper.PsychologyknowledgeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PsychologykonwledgeService {
    @Autowired
    PsychologyknowledgeMapper psychologyknowledgeMapper;

    public int addPsychologyknowledge(Psychologyknowledge p) {
        return psychologyknowledgeMapper.insert(p);
    }
//    public List<Psychologyknowledge> getAllPsychologyknowledge() {
//        return psychologyknowledgeMapper.selectAll();
//    }
//    模糊查询
public PageInfo<Psychologyknowledge> getAllPsychologyknowledge(Psychologyknowledge record,int pageNum,int pageSize) {
      PageHelper.startPage(pageNum,pageSize);
      List<Psychologyknowledge> list = psychologyknowledgeMapper.selectAll(record);
      PageInfo<Psychologyknowledge> pageInfo = new PageInfo<>(list);
      return pageInfo;


}
    public int deletePsychologyknowledge(long id) {
        return psychologyknowledgeMapper.deleteByPrimaryKey(id);

    }
    public int deleteManyPsychologyknowledge(List<Integer> ids) {
        return psychologyknowledgeMapper.DeleteByPrimaryMany(ids);

    }
//    修改部分
   public int updateSelectivePsychologyknowledge(Psychologyknowledge p) {
        return psychologyknowledgeMapper.updateByPrimaryKeySelective(p);
   }
////模糊查询
//    public List<Psychologyknowledge> searchPsychologyknowledge(Psychologyknowledge record) {
//        return psychologyknowledgeMapper.selectByExample(record);
//    }



}
